package demo;
import java.util.Arrays;
class Student{
    public String name;
    public int age;
    public int score;
    public Student(String name ,int age, int score){
        this.name = name;
        this.age = age;
        this.score = score;
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }
}
//测试类
public class Test2 {
    public static void main(String[] args) {
        Student[] student = new Student[3];
        student[0] = new Student("zhangsan", 19, 10);
        student[1] = new Student("lisi", 29, 20);
        student[2] = new Student("wangwu", 39, 5);

        Arrays.sort(student);//这样排序编译器会报错，因为编译器不知道按什么方式给数组成员排序
        System.out.println(Arrays.toString(student));
    }
}